package com.fpt.edu.vn.h2tv.dao.entity;

import java.sql.Timestamp;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * TbTags entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tb_tags", catalog = "bookdb")
public class TbTags implements java.io.Serializable {

	// Fields

	private TbTagsId id;
	private TbBook tbBook;
	private Timestamp createtime;
	private Timestamp updatetime;

	// Constructors

	/** default constructor */
	public TbTags() {
	}

	/** full constructor */
	public TbTags(TbTagsId id, TbBook tbBook, Timestamp createtime,
			Timestamp updatetime) {
		this.id = id;
		this.tbBook = tbBook;
		this.createtime = createtime;
		this.updatetime = updatetime;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "tag", column = @Column(name = "TAG", nullable = false)),
			@AttributeOverride(name = "bookid", column = @Column(name = "BOOKID", nullable = false)) })
	public TbTagsId getId() {
		return this.id;
	}

	public void setId(TbTagsId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "BOOKID", nullable = false, insertable = false, updatable = false)
	public TbBook getTbBook() {
		return this.tbBook;
	}

	public void setTbBook(TbBook tbBook) {
		this.tbBook = tbBook;
	}

	@Column(name = "CREATETIME", nullable = false, length = 19)
	public Timestamp getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Timestamp createtime) {
		this.createtime = createtime;
	}

	@Column(name = "UPDATETIME", nullable = false, length = 19)
	public Timestamp getUpdatetime() {
		return this.updatetime;
	}

	public void setUpdatetime(Timestamp updatetime) {
		this.updatetime = updatetime;
	}

}